package com.wisezone.HomeWork.home0218;

import com.wisezone.demo0217.Person;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;

public class Test04 {
    public void test2() throws Exception{
        System.out.println("-----------------------");
        Class clazz = Person.class;
        Field[] fields = clazz.getDeclaredFields();
        for (Field field : fields){
            //获取访问修饰符
            int i = field.getModifiers();
            String m = Modifier.toString(i);
            System.out.println("访问修饰符："+i+"：：："+m);
            //获取属性的类型
            System.out.println("数据类型："+field.getType());
            //获取变量名称
            System.out.println("变量名称："+field.getType());

        }
    }
}
